MAX_TAB_STOPS = 32


struct CHARFORMAT
  .cbSize          dd ?
  .dwMask          dd ?
  .dwEffects       dd ?
  .yHeight         dd ?
  .yOffset         dd ?
  .crTextColor     dd ?
  .bCharSet        db ?
  .bPitchAndFamily db ?
  .szFaceName      rb 32
  ._wPad2          dw ?
ends


struct CHARFORMAT2
  .cbSize       dd ?
  .dwMask       dd ?
  .dwEffects    dd ?
  .yHeight      dd ?
  .yOffset      dd ?
  .crTextColor  dd ?
  .bCharSet     db ?
  .bPitchAndFamily db ?
  .szFaceName   rb 32
  ._wPad2       dw ?
  .wWeight      dw ?
  .sSpacing     dw ?
  .crBackColor  dd ?
  .lcid         dd ?
  .dwReserved   dd ?
  .sStyle       dw ?
  .wKerning     dw ?
  .bUnderlineType db ?
  .bAnimation     db ?
  .bRevAuthor     db ?
  .bReserved1     db ?
ends


struct SETTEXTEX
  .flags dd ?
  .codepage dd ?
ends

struct CHARRANGE
  .cpMin dd ?
  .cpMax dd ?
ends


struct ENLINK
  .nmhdr   NMHDR
  .msg     dd ?
  .wParam  dd ?
  .lParam  dd ?
  .chrg    CHARRANGE
ends

struct TEXTRANGE
  .chrg      CHARRANGE
  .lpstrText dd ?
ends


struct PARAFORMAT2
  .cbSize           dd  ?
  .dwMask           dd  ?
  .wNumbering       dw  ?
  .wEffects         dw  ?
  .dxStartIndent    dd  ?
  .dxRightIndent    dd  ?
  .dxOffset         dd  ?
  .wAlignment       dw  ?
  .cTabCount        dw  ?
  .rgxTabs          rd  MAX_TAB_STOPS
  .dySpaceBefore    dd  ?
  .dySpaceAfter     dd  ?
  .dyLineSpacing    dd  ?
  .sStyle           dw  ?
  .bLineSpacingRule db  ?
  .bOutlineLevel    db  ?
  .wShadingWeight   dw  ?
  .wShadingStyle    dw  ?
  .wNumberingStart  dw  ?
  .wNumberingStyle  dw  ?
  .wNumberingTab    dw  ?
  .wBorderSpace     dw  ?
  .wBorderWidth     dw  ?
  .wBorders         dw  ?
ends

ES_NOOLEDRAGDROP        = 000000008h
ES_DISABLENOSCROLL      = 000002000h
ES_SUNKEN               = 000004000h
ES_SAVESEL              = 000008000h
ES_SELFIME              = 000040000h
ES_NOIME                = 000080000h
ES_VERTICAL             = 000400000h
ES_SELECTIONBAR         = 001000000h

ES_EX_NOCALLOLEINIT     = 001000000h

EM_CANPASTE             = WM_USER + 50
EM_DISPLAYBAND          = WM_USER + 51
EM_EXGETSEL             = WM_USER + 52
EM_EXLIMITTEXT          = WM_USER + 53
EM_EXLINEFROMCHAR       = WM_USER + 54
EM_EXSETSEL             = WM_USER + 55
EM_FINDTEXT             = WM_USER + 56
EM_FORMATRANGE          = WM_USER + 57
EM_GETCHARFORMAT        = WM_USER + 58
EM_GETEVENTMASK         = WM_USER + 59
EM_GETOLEINTERFACE      = WM_USER + 60
EM_GETPARAFORMAT        = WM_USER + 61
EM_GETSELTEXT           = WM_USER + 62
EM_HIDESELECTION        = WM_USER + 63
EM_PASTESPECIAL         = WM_USER + 64
EM_REQUESTRESIZE        = WM_USER + 65
EM_SELECTIONTYPE        = WM_USER + 66
EM_SETBKGNDCOLOR        = WM_USER + 67
EM_SETCHARFORMAT        = WM_USER + 68
EM_SETEVENTMASK         = WM_USER + 69
EM_SETOLECALLBACK       = WM_USER + 70
EM_SETPARAFORMAT        = WM_USER + 71
EM_SETTARGETDEVICE      = WM_USER + 72
EM_STREAMIN             = WM_USER + 73
EM_STREAMOUT            = WM_USER + 74
EM_GETTEXTRANGE         = WM_USER + 75
EM_FINDWORDBREAK        = WM_USER + 76
EM_SETOPTIONS           = WM_USER + 77
EM_GETOPTIONS           = WM_USER + 78
EM_FINDTEXTEX           = WM_USER + 79
EM_GETWORDBREAKPROCEX   = WM_USER + 80
EM_SETWORDBREAKPROCEX   = WM_USER + 81
EM_SETUNDOLIMIT         = WM_USER + 82
EM_REDO                 = WM_USER + 84
EM_CANREDO              = WM_USER + 85
EM_GETUNDONAME          = WM_USER + 86
EM_GETREDONAME          = WM_USER + 87
EM_STOPGROUPTYPING      = WM_USER + 88
EM_SETTEXTMODE          = WM_USER + 89
EM_GETTEXTMODE          = WM_USER + 90
EM_AUTOURLDETECT        = WM_USER + 91
EM_GETAUTOURLDETECT     = WM_USER + 92
EM_SETPALETTE           = WM_USER + 93
EM_GETTEXTEX            = WM_USER + 94
EM_GETTEXTLENGTHEX      = WM_USER + 95
EM_SHOWSCROLLBAR        = WM_USER + 96
EM_SETTEXTEX            = WM_USER + 97
EM_SETPUNCTUATION       = WM_USER + 100
EM_GETPUNCTUATION       = WM_USER + 101
EM_SETWORDWRAPMODE      = WM_USER + 102
EM_GETWORDWRAPMODE      = WM_USER + 103
EM_SETIMECOLOR          = WM_USER + 104
EM_GETIMECOLOR          = WM_USER + 105
EM_SETIMEOPTIONS        = WM_USER + 106
EM_GETIMEOPTIONS        = WM_USER + 107
EM_CONVPOSITION         = WM_USER + 108
EM_SETLANGOPTIONS       = WM_USER + 120
EM_GETLANGOPTIONS       = WM_USER + 121
EM_GETIMECOMPMODE       = WM_USER + 122
EM_FINDTEXTW            = WM_USER + 123
EM_FINDTEXTEXW          = WM_USER + 124
EM_RECONVERSION         = WM_USER + 125
EM_SETIMEMODEBIAS       = WM_USER + 126
EM_GETIMEMODEBIAS       = WM_USER + 127
EM_SETBIDIOPTIONS       = WM_USER + 200
EM_GETBIDIOPTIONS       = WM_USER + 201
EM_SETTYPOGRAPHYOPTIONS = WM_USER + 202
EM_GETTYPOGRAPHYOPTIONS = WM_USER + 203
EM_SETEDITSTYLE         = WM_USER + 204
EM_GETEDITSTYLE         = WM_USER + 205
EM_OUTLINE              = WM_USER + 220
EM_GETSCROLLPOS         = WM_USER + 221
EM_SETSCROLLPOS         = WM_USER + 222
EM_SETFONTSIZE          = WM_USER + 223
EM_GETZOOM              = WM_USER + 224
EM_SETZOOM              = WM_USER + 225

CFM_BOLD        = 00000001h
CFM_ITALIC      = 00000002h
CFM_UNDERLINE   = 00000004h
CFM_STRIKEOUT   = 00000008h
CFM_PROTECTED   = 00000010h
CFM_LINK        = 00000020h
CFM_SMALLCAPS   = 00000040h
CFM_ALLCAPS     = 00000080h
CFM_HIDDEN      = 00000100h
CFM_OUTLINE     = 00000200h
CFM_SHADOW      = 00000400h
CFM_EMBOSS      = 00000800h
CFM_IMPRINT     = 00001000h
CFM_DISABLED    = 00002000h
CFM_REVISED     = 00004000h
CFM_REVAUTHOR   = 00008000h
CFM_SUBSCRIPT   = CFE_SUBSCRIPT or CFE_SUPERSCRIPT ; = 00030000h
CFM_ANIMATION   = 00040000h
CFM_STYLE       = 00080000h
CFM_KERNING     = 00100000h
CFM_SPACING     = 00200000h
CFM_WEIGHT      = 00400000h
CFM_UNDERLINETYPE=00800000h
;                = 01000000h
CFM_LCID        = 02000000h
CFM_BACKCOLOR   = 04000000h
CFM_CHARSET     = 08000000h
CFM_OFFSET      = 10000000h
CFM_FACE        = 20000000h
CFM_COLOR       = 40000000h
CFM_SIZE        = 80000000h


CFE_BOLD        = 00000001h
CFE_ITALIC      = 00000002h
CFE_UNDERLINE   = 00000004h
CFE_STRIKEOUT   = 00000008h
CFE_PROTECTED   = 00000010h
CFE_PROTECTED   = 00000010h
CFE_LINK        = 00000020h
CFE_ALLCAPS     = CFM_ALLCAPS
CFE_HIDDEN      = CFM_HIDDEN
CFE_OUTLINE     = CFM_OUTLINE
CFE_SHADOW      = CFM_SHADOW
CFE_EMBOSS      = CFM_EMBOSS
CFE_IMPRINT     = CFM_IMPRINT
CFE_DISABLED    = CFM_DISABLED
CFE_REVISED     = CFM_REVISED
CFE_AUTOBACKCOLOR = CFM_BACKCOLOR

CFE_SUBSCRIPT   = 00010000h
CFE_SUPERSCRIPT = 00020000h

CFE_AUTOCOLOR   = 40000000h



SCF_SELECTION = 0001h
SCF_WORD      = 0002h

SF_TEXT       = 0001h
SF_RTF        = 0002h
SF_RTFNOOBJS  = 0003h
SF_TEXTIZED   = 0004h

SFF_SELECTION = 8000h
SFF_PLAINRTF  = 4000h

ST_DEFAULT      = 0
ST_KEEPUNDO     = 1
ST_SELECTION    = 2
ST_NEWCHARS     = 4


EN_LINK = $0000070b


ENM_NONE = 000000000h
ENM_CHANGE = 000000001h
ENM_UPDATE = 000000002h
ENM_SCROLL = 000000004h
ENM_SCROLLEVENTS = 000000008h
ENM_DRAGDROPDONE = 000000010h
ENM_PARAGRAPHEXPANDED = 000000020h
ENM_PAGECHANGE = 000000040h
ENM_KEYEVENTS = 000010000h
ENM_MOUSEEVENTS = 000020000h
ENM_REQUESTRESIZE = 000040000h
ENM_SELCHANGE = 000080000h
ENM_DROPFILES = 000100000h
ENM_PROTECTED = 000200000h
ENM_CORRECTTEXT = 000400000h
ENM_IMECHANGE = 000800000h
ENM_LANGCHANGE = 001000000h
ENM_OBJECTPOSITIONS = 002000000h
ENM_LINK = 004000000h
ENM_LOWFIRTF = 008000000h

TM_PLAINTEXT            = 1
TM_RICHTEXT             = 2
TM_SINGLELEVELUNDO      = 4
TM_MULTILEVELUNDO       = 8
TM_SINGLECODEPAGE       = 16
TM_MULTICODEPAGE        = 32


PFM_STARTINDENT         = 000000001h
PFM_RIGHTINDENT         = 000000002h
PFM_OFFSET              = 000000004h
PFM_ALIGNMENT           = 000000008h
PFM_TABSTOPS            = 000000010h
PFM_NUMBERING           = 000000020h
PFM_OFFSETINDENT        = 080000000h
PFM_SPACEBEFORE         = 000000040h
PFM_SPACEAFTER          = 000000080h
PFM_LINESPACING         = 000000100h
PFM_STYLE               = 000000400h
PFM_BORDER              = 000000800h
PFM_SHADING             = 000001000h
PFM_NUMBERINGSTYLE      = 000002000h
PFM_NUMBERINGTAB        = 000004000h
PFM_NUMBERINGSTART      = 000008000h
PFM_RTLPARA             = 000010000h
PFM_KEEP                = 000020000h
PFM_KEEPNEXT            = 000040000h
PFM_PAGEBREAKBEFORE     = 000080000h
PFM_NOLINENUMBER        = 000100000h
PFM_NOWIDOWCONTROL      = 000200000h
PFM_DONOTHYPHEN         = 000400000h
PFM_SIDEBYSIDE          = 000800000h
PFM_TABLE               = 040000000h
PFM_TEXTWRAPPINGBREAK   = 020000000h
PFM_TABLEROWDELIMITER   = 010000000h
PFM_COLLAPSED           = 001000000h
PFM_OUTLINELEVEL        = 002000000h
PFM_BOX                 = 004000000h
PFM_RESERVED2           = 008000000h
PFM_ALL                 = PFM_STARTINDENT or PFM_RIGHTINDENT or         \
                          PFM_OFFSET or PFM_ALIGNMENT or                \
                          PFM_TABSTOPS or PFM_NUMBERING or              \
                          PFM_OFFSETINDENT or PFM_RTLPARA

PFM_EFFECTS             = PFM_RTLPARA or PFM_KEEP or PFM_KEEPNEXT or    \
                          PFM_TABLE or PFM_PAGEBREAKBEFORE or           \
                          PFM_NOLINENUMBER or PFM_NOWIDOWCONTROL or     \
                          PFM_DONOTHYPHEN or PFM_SIDEBYSIDE or          \
                          PFM_TABLE or PFM_TABLEROWDELIMITER

PFM_ALL2                = PFM_ALL or PFM_EFFECTS or PFM_SPACEBEFORE or  \
                          PFM_SPACEAFTER or PFM_LINESPACING or          \
                          PFM_STYLE or PFM_SHADING or PFM_BORDER or     \
                          PFM_NUMBERINGTAB or PFM_NUMBERINGSTART or     \
                          PFM_NUMBERINGSTYLE
